﻿using System.Net;
using System.Net.Security;
using Letter.IO.Binary;
using Letter.Net.SSL;
using Letter.Net.Tcp;
using ssl_connection;

namespace ssl_server1;

class Program
{
    static async Task Main()
    {
        var server = TcpProvider.Server();
        server.ConfigureChannelOptions(new TcpServerTransportOptions());
        server.ConfigureFeatureOptions(new TcpServerFeatureOptions());
        server.ConfigureConnection(() => new SslConnection(BinaryOrder.BigEndian, new SSLServerOptions(common.SocketConfig.cert, false, false), stream =>
        {
            return new SslStream(stream, true, (sender, certificate, chain, sslPolicyErrors) => true);
        }));
        
        server.Build();
        await server.BindAsync(IPEndPoint.Parse(SslConnection.serverAddr));

        while (true)
        {
            Console.ReadLine();
        }
        
    }
}